#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      chmiboe
#
# Created:     30-08-2010
# Copyright:   (c) chmiboe 2010
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python

def input1():
    import sys
    print 'Enter your name: ',

    name = ''

    while True:
       c = sys.stdin.read(1)
       if c == '\n':
          break
       name = name + c

    print 'Your name is:', name

def input2():
    a=4711
    data = input('Enter expression: ')
    print 'You have entered:', data

def input3():
    name = raw_input('Enter your name: ')
    print 'You have entered:', name

def output1():
    import sys
    sys.stdout.write('ZingZang\n')
    sys.stdout.write('Lupp\n')

def outputFileWriter():
    f = open('works', 'w')

    print >> f, 'Beatrix'
    print >> f, 'Honorine'
    print >> f, 'The firm of Nucingen'

    f.close()

def outputRedirection():
    import sys

    f = open('output.txt', 'w')
    sys.stdout = f

    print 'Lucien'
    sys.stdout.write('Rastignac\n')
    sys.stdout.writelines(['Camusot\n', 'Collin\n'])

    sys.stdout = sys.__stdout__

    print 'Bianchon'
    sys.stdout.write('Lambert\n')

def getFileAndPrint():
    f = open('testIO.py', 'r')
    for line in f:
       print line,

    f.close()

def getFileAndPrint2():
    f = open('testIO.py', 'r')

    while True:
       line = f.readline()
       if not line: break
       else: print line,

    f.close()

def getFileAndPrint3():
    f = open('testIO.py', 'r')
    contents = f.readlines()
    for i in contents:
       print i,
    f.close()

def fileWriter2():
    text = """Incompatible, it don't matter though
    'cos someone's bound to hear my cry
    Speak out if you do
    You're not easy to find\n"""
    f = open('strophe.txt', 'w')
    f.write(text)
    f.close()


fileWriter2()

